<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>

<head>
    <style>
        .aa {
            color: red;
        }
    </style>
    <meta charset="UTF-8">
    <title>欢迎页面-X-admin2.0</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="./css/font.css">
    <link rel="stylesheet" href="./css/xadmin.css">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script type="text/javascript" src="./lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="./js/xadmin.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>


    <![endif]-->
    <script type="text/javascript" src="js/jquery-1.12.4.min.js"></script>
    <script type="text/javascript">
        //日期的正则表达式^\d{4}(\-|\/|\.)\d{1,2}\1\d{1,2}$

        $(function() {
            $("#adds").submit(function () {

//安装员id
                var staffid = $(".a").val();
                if (staffid == -1) {
                    $("#staffids").html("安装员id:未选择");
                    return false;
                }
                $("#staffids").html();
                //用户电话
                var userPhone = $("#userPhone").val();
                var reg = /^1[3|5|7|8]\d{9}$/
                if (reg.test(userPhone) == false) {
                    $("#userPhones").html("不符合规范或手机号不为11位数字！");
                    return false;
                }
                $("#userPhones").html();
     //工单类型workType
                var workType = $(".b").val();
                if (workType == -1) {
                    $("#workTypes").html("工单类型:未选择");
                    return false;
                }
                $("#workTypes").html();
     //状态status
                var status = $(".c").val();
                if (status == -1) {
                    $("#statuss").html("状态:未选择");
                    return false;
                }
                $("#statuss").html();
       //净水器wpid
                var wpid = $(".d").val();
                if (wpid == -1) {
                    $("#wpids").html("净水器:未选择");
                    return false;
                }
                $("#wpids").html();
        });
                $("select").val(-1);
        });
    </script>
</head>

<body>
<div class="x-body layui-anim layui-anim-up">
    <form class="layui-form" id="adds" action="addwork"  method="post">
 <div class="layui-form-item">
              <label  class="layui-form-label">
                 <span class="x-red">*</span>安装员
              </label>
    <div class="layui-input-inline">

        <select name="staffid" class="a">
            <option value="-1">--请选择--</option>
            <c:forEach  items="${lists}" var="t">
            <c:forEach  items="${t.ulist}" var="p">
                <option value="${t.staffid}">${p.uname}</option>
            </c:forEach>
            </c:forEach>
        </select>
        <span id="staffids" class="aa"></span>
    </div>
</div>

        <div class="layui-form-item">
            <label  class="layui-form-label">
                <span class="x-red">*</span>用户姓名
            </label>
            <div class="layui-input-inline">
                <input type="text" id="userName" name="userName" required="" lay-verify="userName"
                       autocomplete="off" class="layui-input">
                <span id="userNames" class="aa"></span>
            </div>
        </div>

        <div class="layui-form-item">
            <label  class="layui-form-label">
                <span class="x-red">*</span>用户电话
            </label>
            <div class="layui-input-inline">
                <input type="text" id="userPhone" name="userPhone" required="" lay-verify="userPhone"
                       autocomplete="off" class="layui-input">
                <span id="userPhones" class="aa"></span>
            </div>
        </div>

        <div class="layui-form-item">
            <label  class="layui-form-label">
                <span class="x-red">*</span>地址
            </label>
            <div class="layui-input-inline">
                <input type="text" id="userAddress" name="userAddress" required="" lay-verify="userAddress"
                       autocomplete="off" class="layui-input">
                <span id="userAddresss" class="aa"></span>
            </div>
        </div>

        <div class="layui-form-item">
            <label  class="layui-form-label">
                <span class="x-red">*</span>工单类型
            </label>
            <div class="layui-input-inline">

                <select name="workType" class="b">
                    <option value="-1">--请选择--</option>
                    <option value="1">安装工单</option>
                    <option value="2">滤芯更换工单</option>
                    <option value="3">报修</option>
                    <option value="4">已处理</option>
                </select>
                <span id="workTypes" class="aa"></span>
            </div>
        </div>

        <div class="layui-form-item">
            <label  class="layui-form-label">
                <span class="x-red">*</span>状态
            </label>
            <div class="layui-input-inline">

                <select name="status" class="c">
                    <option value="-1">--请选择--</option>
                    <option value="1">待处理</option>
                    <option value="2">处理中</option>
                    <option value="3">已处理</option>
                </select>
                <span id="statuss" class="aa"></span>
            </div>
        </div>

        <div class="layui-form-item">
            <label  class="layui-form-label">
                <span class="x-red">*</span>净水器
            </label>
            <div class="layui-input-inline">

                <select name="wpid" class="a">
                    <option value="-1">--请选择--</option>
                    <c:forEach  items="${listk}" var="p">

                        <option value="${p.wpid}">${p.waterName}</option>

                    </c:forEach>
                </select>
                <span id="wpids" class="aa"></span>
            </div>
        </div>

        <div class="layui-form-item">
            <label  class="layui-form-label">
            </label>
            <input  class="layui-btn" lay-filter="adds" lay-submit="" type="submit" value="增加"/>
        </div>
    </form>
</div>
</body>

</html>